package com.neo4j.neo4jcloud.service.impl;

import com.neo4j.neo4jcloud.entity.CompanyGraph;
import com.neo4j.neo4jcloud.mapper.CompanyGraphRepository;
import com.neo4j.neo4jcloud.service.CompanyGraphService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @author kabuqinuo
 * @date 2020/3/26 14:11
 */
@Service
public class CompanyGraphServiceImpl implements CompanyGraphService {

    @Autowired
    private CompanyGraphRepository companyGraphRepository;


    @Override
    public CompanyGraph addCompanyGraph(CompanyGraph companyGraph) {
        return companyGraphRepository.save(companyGraph);
    }

    @Override
    public CompanyGraph findOneByCompanyGraphId(Long id) {
        return companyGraphRepository.findById(id).get();
    }

    @Override
    public void deletOneByCompanyGraphId(Long id) {
        companyGraphRepository.deleteById(id);
    }

    @Override
    public CompanyGraph findOneByNodeId(String nodeId) {
        return companyGraphRepository.findOneByNodeId(nodeId);
    }
}
